package com.syni.mdd.yhd.common.all.dao.jpa;

import com.syni.mdd.yhd.common.all.dao.BaseJPADao;
import com.syni.mdd.yhd.common.all.entity.BmsBusinessCoupon;
import com.syni.mdd.yhd.common.all.entity.BmsDxGroupBuy;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Set;

public interface BmsBusinessCouponDao extends BaseJPADao<BmsBusinessCoupon,Integer> {
    List<BmsBusinessCoupon> findByBusinessId(Integer businessId);

    BmsBusinessCoupon findByIdAndIsDelete(Integer couponId,Integer isDelete);

    @Query(value = "select count(*) from bms_business_coupon bbc where bbc.business_id = ?1" +
            " and bbc.status = ?2 and bbc.is_delete = 0",nativeQuery = true)
    Integer countCouponStatusNum(Integer businessId, Integer couponStatus);

    List<BmsBusinessCoupon> findByIdIn(Set<Integer> couponIds);
}
